{include file='common/head' /}
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <input type="hidden" name="id" value="{$data.id|default=''}">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    收货人
                </label>
                <div class="layui-input-inline">
                    <input type="text" name="name" required="" autocomplete="off" class="layui-input" value="{$data.name|default=''}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    联系电话
                </label>
                <div class="layui-input-inline">
                    <input type="text" name="tel" required="" autocomplete="off" class="layui-input" value="{$data.tel|default=''}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    收货地址
                </label>
                <div class="layui-input-inline">
                    <textarea placeholder="请输入内容" name="address" class="layui-textarea">{$data.address|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    备注
                </label>
                <div class="layui-input-inline">
                    <textarea placeholder="请输入内容" name="remarks" class="layui-textarea">{$data.remarks|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    设为默认
                </label>
                <div class="layui-input-inline">
                    {if condition="empty($data['is_def'])"}
                    <input type="radio" name="is_def" value="1" title="是">
                    <input type="radio" name="is_def" value="0" title="否" checked>
                    {else /}
                    <input type="radio" name="is_def" value="1" title="是" {if condition="$data['is_def'] eq 1"}checked{/if}>
                    <input type="radio" name="is_def" value="0" title="否" {if condition="$data['is_def'] eq 0"}checked{/if}>
                    {/if}
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="add" lay-submit="">确定保存</button></div>
        </form>
    </div>
</div>
<script>layui.use(['form', 'layer','jquery'],
    function() {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        //监听提交
        form.on('submit(add)', function(data) {
            $.ajax({
                url:"{:url('Setting/receipt_edit')}",
                type: "post",
                data:data.field,
                dataType:"json",
                success:function (res) {
                    if(res.code == 200){
                        layer.alert(res.msg, {icon: 1},function () {
                            //关闭当前frame
                            xadmin.close();
                            // 可以对父窗口进行刷新
                            xadmin.father_reload();
                        });
                    }else{
                        layer.alert(res.msg, {icon:2,time:1000});
                    }
                },
                error:function(e){
                    layer.alert("网络错误", {icon:5,time:1000});
                },
            });
            return false;
        });

    });
</script>
{include file='common/footer' /}